package com.leucoderma.medicine.controller;

import com.leucoderma.medicine.pojo.Patient;
import com.leucoderma.medicine.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class PatientController {
    @Autowired
    PatientService patientService;

    @ResponseBody
    @RequestMapping("/listPatients")
    List<Patient> listPatients(){
        return patientService.listPatients();
    }
    @ResponseBody
    @RequestMapping("/getPatientById")
    Patient getPatientById(Long id){
        return patientService.getPatientById(id);
    }

    @ResponseBody
    @RequestMapping("/patientLogin")
    Patient getPatientByNameAndRecordNo(String name,String recordNo){
        return patientService.getPatientByNameAndRecordNo(name,recordNo);
    }
}
